const pkg = require('./package')
const webpack = require('webpack')

module.exports = {
  mode: 'spa',

  /*
  ** Headers of the page
  */
  head: {
    title: pkg.name,
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: pkg.description }
    ],
    script: [

      { src: '/js/bootstrap.min.js' },
      { src: '/js/demo.js' },
      { src: '/js/jquery.min.js' },
      { src: '/js/jquery.picsign.js' },
      { src: '/js/jquery.webui-popover.min.js' },
      { src: '/js/json2.min.js' },
      { src: '/js/layer.js' },
      {src:'/js/gDBox.pkg.min.js'}
    ]
  },

  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#fff' },

  /*
  ** Global CSS
  */
  css: ['element-ui/lib/theme-chalk/index.css', './static/iconfont.css','assets/main.css'],

  /*
  ** Plugins to load before mounting the App
  */
  plugins: ['@/plugins/element-ui', '@/plugins/spost', './static/iconfont.js', '@/plugins/echarts', '@/plugins/amap'],

  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://github.com/nuxt-community/axios-module#usage
  ],
  /*
  ** Axios module configuration
  */
  /*
  ** Build configuration
  */
 build: {
  /*
  ** You can extend webpack config here
  */
  extend (config, ctx) {
    // Run ESLint on save
    const vueLoader = config.module.rules.find((loader) => loader.loader === 'vue-loader');
   /* 把audio标签在编译时转成src属性 */
    vueLoader.options.transformToRequire = {
      audio: 'src'
    };
    /* 对mp3等格式的文件用url-loader进行处理 */
    config.module.rules.push({
      test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
      loader: 'url-loader',
      options: {
        limit: 10000
      }
    });
    // if (ctx.isDev && ctx.isClient) {
    //   config.module.rules.push({
    //     enforce: 'pre',
    //     test: /\.(js|vue)$/,
    //     loader: 'eslint-loader',
    //     exclude: /(node_modules)/
    //   });
    // }
  }
}
}
